<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/common/includes.jsp" %>

<!DOCTYPE html>
<html lang="${currentLocale}">

<head>
	<title>zzzzzz - 发表文字</title>
	<%@ include file="/WEB-INF/common/meta.jsp" %>
	<%@ include file="/WEB-INF/common/global_res.jsp" %>
	<script type="text/javascript" src="<c:url value="/res/validate/jquery.validate.min.js" />"></script>
	<script type="text/javascript" src="<c:url value="/res/validate/messages_zh_CN.js" />"></script>
	
	<link rel="stylesheet" href="<c:url value="/res/lib/uploadify/uploadify.css" />" type="text/css"></link>
	<script type="text/javascript" src="<c:url value="/res/lib/uploadify/jquery.uploadify.min.js" />"></script>
	<script>
		var ctx = "${ctx}";
		var picItemId = null;
		$(function() {
		    $("#files").uploadify({
		    	'height'        	: 27, 
		    	'width'         	: 80,  
		    	'buttonText'    	: '浏 览',
		        'swf'           	: ctx + '/res/lib/uploadify/uploadify.swf',
		        'uploader'      	: ctx + '/picitem/upload;jsessionid=${pageContext.session.id}?picTextId=${picTextId}',
		        'auto'          	: false,
		        'multi' 			: true,
		        'fileTypeExts'  	: '*.JPG; *.GIF; *.PNG; *.BMP', 
		        'fileTypeDesc' 		: '请选择图片',
		        'fileObjName' 		: 'files',
		        'fileSizeLimit' 	: '1024KB',
		        'uploadLimit' 		: 20,
		        'queueID'  			: 'fileQuene',
		        'queueSizeLimit' 	: 20,
		        
		        'onUploadSuccess' 	: function(file, data, response){
		        	console.log(data);console.log(response);
		        	if(response && picItemId == null){
		        		picItemId = data;
		        	}
		        },
		        'onQueueComplete' 	: function(queueData) {
		        	//console.log(queueData.uploadsSuccessful + ' files were successfully uploaded.');
		        	window.location.href = ctx + '/picitem/' + picItemId + '/add';
		        }
		    });
		});
	</script>
</head>
<body>

<%@ include file="/WEB-INF/common/header.jsp" %>

<div class="container">
	<div class="row">
		<div class="span9">
			<div class="row-fluid">
				<div class="span12">
					<ul class="nav nav-tabs">
					    <li>
					    	<a href="${ctx}">文字</a>
					    </li>
					    <li class="active">
					    	<a href="${ctx}">图文</a>
					    </li>
					    <li>
					    	<a href="${ctx}">观后感</a>
					    </li>
					 </ul>
					<div class="row-fluid">
				        <div class="span12" id="fileQuene">
							
						</div>
					</div> 
					<div class="row-fluid">
				        <div class="span12">
							<input type="file" name="files" id="files" />  
							<hr>
							<a href="javascript:$('#files').uploadify('upload','*')" class="btn">开始上传</a>   
                			<a href="javascript:$('#files').uplaodify('cancel','*')" class="btn">取消上传</a>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="span3 rightbox">
				<div class="row-fluid">
					<div class="span12">
						<p style="padding-bottom: 20px;"><img src="${ctx}/res/imgs/test/1.jpg" alt="" class="pull-right"></p>
						<p><img src="${ctx}/res/imgs/test/2.jpg" alt="" class="pull-right"></p>
					</div>
				</div>
			</div>
	</div>
</div>

<%@ include file="/WEB-INF/common/footer.jsp" %>
</body>

</html>